# Maintainer: Felix Yan <felixonmars@archlinux.org>

pkgname=deepin-anything-arch
pkgver=5.0.18
pkgrel=56
pkgdesc="Deepin Anything file search tool, kernel module for Arch kernel"
arch=('loong64' 'x86_64')
url="https://github.com/linuxdeepin/deepin-anything"
license=('GPL3')
makedepends=('linux-headers')
provides=('DEEPIN-ANYTHING-MODULE')
replaces=('deepin-anything-module')
source=("https://github.com/linuxdeepin/deepin-anything/archive/$pkgver/deepin-anything-$pkgver.tar.gz")
sha512sums=('73cc90f394b53a8d8edc17b258b63789cddd3094008de8403b24cdb0ed94e677cb9eedac297b73e8142204612a4ae5119450ebb08be4ea1c94abf0d375f8b51d')

build() {
  cd deepin-anything-$pkgver
  make -C kernelmod kdir=/usr/src/linux
}

package() {
  depends=('linux')

  cd deepin-anything-$pkgver
  local extradir=/usr/lib/modules/$(</usr/src/linux/version)/extramodules
  install -Dt "$pkgdir$extradir" -m644 kernelmod/*.ko
  find "$pkgdir" -name '*.ko' -exec strip --strip-debug {} +
  find "$pkgdir" -name '*.ko' -exec xz {} +
}
